/**
 * Servicio de metainformacion
 *
 * @date 15/10/2008
 * @author Carlos Rodriguez Dominguez
 */

#include <Ice/Ice.h>
#include <iostream>
#include "collaboration.h"
#include "MIDataAccessor.h"

int main(int argc, char* argv[])
{
	int status = 0;
	Ice::CommunicatorPtr ic;
	try {
		ic = Ice::initialize(argc, argv);
		Ice::ObjectAdapterPtr adapter = ic->createObjectAdapterWithEndpoints("MIDataAccessorAdapter", "default -p 11000");
	    Ice::ObjectPtr object = new MIDataAccessor_impl();
	    adapter->add(object, ic->stringToIdentity("MIDataAccessor"));
	    adapter->activate();
	    ic->waitForShutdown();
	} catch(const Ice::Exception& e)
	{
		std::cerr << e << std::endl;
	} catch(const char* msg)
	{
		std::cerr << msg << std::endl;
		status = -1;
	}
	
	if (ic)
	{
		try {
			ic->destroy();
		} catch(const Ice::Exception& e)
		{
			std::cerr << e << std::endl;
			status = 1;
		}
	}

    return status;
}
